<%@ page contentType="application/json; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="pe.gob.pnp.despachadores.*" %>
<%@ page import="pe.gob.pnp.actions.*" %>
<%@ page import="java.util.*"%>
<%
    String expediente = request.getParameter("expediente");
    List<RtsBean> listarts = RtsDespachador.obtenerRTSPersona(Integer.parseInt(expediente));
    pageContext.setAttribute("lrts", listarts);
%>
<c:set var="i" value="0"></c:set>
{
		tablaRTS:
		[

        <c:forEach var="rts" items="${lrts}">
            <%
                RtsBean obj= (RtsBean) pageContext.getAttribute("rts");
                String resolucion = obj.getCrtpe_resolucion()!=null?obj.getCrtpe_resolucion():"";
		resolucion = resolucion.replaceAll("\"","'");
		resolucion = resolucion.replaceAll("\'","\\\'");
		resolucion = resolucion.replaceAll("\r\n","\\\\n");
                resolucion = resolucion.replace( new Character('\n'),new Character(' ') );
                resolucion = resolucion.replace( new Character('\r'),new Character(' ') );
		pageContext.setAttribute("resolucion", resolucion);

                String parrafo = obj.getNrtpe_parrafo()!=null?obj.getNrtpe_parrafo():"";
		parrafo = parrafo.replaceAll("\"","'");
		parrafo = parrafo.replaceAll("\'","\\\'");
		parrafo = parrafo.replaceAll("\r\n","\\\\n");
                parrafo = parrafo.replace( new Character('\n'),new Character(' ') );
                parrafo = parrafo.replace( new Character('\r'),new Character(' ') );
		pageContext.setAttribute("parrafo", parrafo);
            %>
        ${i>0 ? "," : ""}
	{
            nrtpe_identificador:${rts.nrtpe_identificador},
            nexpe_identificador:${rts.nexpe_identificador},
            nrtpe_totalrts:"${rts.nrtpe_totalrts}",
            crtpe_observaciones: "${resolucion}",
            crtpe_resolucion: "${resolucion}",
            nhias_anios: ${rts.nrtpe_anios},
            nhias_meses: ${rts.nrtpe_meses},
            nrtpe_parrafo: "${parrafo}",
            nhias_dias: ${rts.nrtpe_dias},
            brtpe_eliminado: "${rts.brtpe_eliminado}"
	}
        <c:set var="i" value="${i+1}"></c:set>
        </c:forEach>
		]
}
